package android.alliance.ads.example.advanced;

import android.alliance.ads.actions.OnClickAction;
import android.content.Intent;
import android.net.Uri;


/**
 * Android Alliance - Ads-Library
 *
 * Copyright (c) 2011-2014 Android Alliance
 *
 * http://www.android-alliance.org
 * http://www.droidspirit.com
 * http://www.strangeoptics.com
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use 
 * this file except in compliance with the License. You may obtain a copy of the License at  
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and 
 * limitations under the License.
 * 
 *  E-Mail: support@droidspirit.com
 */


/**
 * Your own Banner-Click-Implementation
 */
public class AdvancedImplementationOnClick extends OnClickAction {

	@Override
	public Intent run(String target){
		
		String marketUrl = "";
		
		if(target.contains("http://www.")){
			marketUrl = target;
		} else {
			marketUrl = "market://details?id=" + target;	
		}
		
		Intent launchIntent = new Intent(Intent.ACTION_VIEW); 
		launchIntent.setData(Uri.parse(marketUrl)); 
		
		return launchIntent;
	}
}
